﻿#include <iostream>
#include "List.h"

using namespace std;

int main()
{
    P_TcNode testList = NULL;
    bool bRet = initList(&testList,10);
    if (!bRet)
    {
        printf("init list error");
    }
    showList(testList);

    printf("append new one start:\n");
    appendNewOne(testList);
    appendNewOne(testList);
    printf("append new one end:\n");
    showList(testList);

    P_TcNode  temp = NULL;
    temp = at(testList,3);

    printf("at id : %d ",temp->m_nodeId);
    printf("at name : %s\n",temp->m_nodeName.c_str());


    P_TcNode pNewNode = new TcNode();
    pNewNode->m_nodeName = "insert new";
    pNewNode->m_nodeId = 5801;
    pNewNode->pNext = NULL;
    insert(testList,pNewNode,4);
    showList(testList);

    P_TcNode pNewNodeOne = new TcNode();
    pNewNodeOne->m_nodeName = "insert new";
    pNewNodeOne->m_nodeId = 5802;
    pNewNodeOne->pNext = NULL;
    const P_TcNode testOne = pNewNodeOne;
    printf("test const before : %d\n",testOne->m_nodeId);
    testOne->m_nodeId = 5803;
    printf("test const after  : %d\n",testOne->m_nodeId);


    return 0;
}
